package com.sleepapp.dto.exception;

import com.sleepapp.utils.ResCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author ziluxike
 * @since 2025/5/26 11:00
 */

@EqualsAndHashCode(callSuper = true)
@Data
public class CustomizeException extends RuntimeException{
    private final Integer code;
    private final String msg;

    public CustomizeException(ResCode resCode){
        this.code = resCode.getCode();
        this.msg = resCode.getMessage();
    }

    public CustomizeException(String msg){
        this.code = ResCode.FAIL.getCode();
        this.msg = msg;
    }

    public CustomizeException(Integer code, String msg){
        this.code = code;
        this.msg = msg;
    }
}
